﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication4
{
    class Board
    {
        private int[] board;
        public int[] Board { get; set; }
        private char[] game;
        public char[] Game { get; set; }
        private int[] game2;
        public int[] Game2 {get;set;}
        private int cont=0;

        public Board()
        {
                for (cont = 0; cont < 64; cont++)
                {
                    for (int columna = 0; columna < 8; columna++)
                    {
                        board[cont] = cont;
                    }
                }

                this.SetInicialPosition();
        }

        public char GetPiece(int square)
        {
            int f = 0;
            char ret = 'v';

            for (f=0; f<64; f++)
            {
                
                    if (board[f] == square)
                        return game[f]; 
                
            }

            return ret;
        }

        
        public void SetInicialPosition()
        {
            game[0] = 'R';
            game[1] = 'N';
            game[2] = 'B';
            game[3] = 'Q';
            game[4] = 'K';
            game[5] = 'B';
            game[6] = 'N';
            game[7] = 'R';
            game[8] = 'P';
            game[9] = 'P';
            game[10] = 'P';
            game[11] = 'P';
            game[12] = 'P';
            game[13] = 'P';
            game[14] = 'P';
            game[15] = 'P';
            
            game2[0] = 1;
            game2[1] = 1;
            game2[2] = 1;
            game2[3] = 1;
            game2[4] = 1;
            game2[5] = 1;
            game2[6] = 1;
            game2[7] = 1;
            game2[8] = 1;
            game2[9] = 1;
            game2[10] = 1;
            game2[11] = 1;
            game2[12] = 1;
            game2[13] = 1;
            game2[14] = 1;
            game2[15] = 1;

            for (int asd = 15; asd < 48; asd++)
                game[asd] = '\0';

            for (int asd = 15; asd < 48; asd++)
                game2[asd] = 0;

            game[48] = 'r';
            game[49] = 'n';
            game[50] = 'b';
            game[51] = 'q';
            game[52] = 'k';
            game[53] = 'b';
            game[54] = 'n';
            game[55] = 'r';
            game[56] = 'p';
            game[57] = 'p';
            game[58] = 'p';
            game[59] = 'p';
            game[60] = 'p';
            game[61] = 'p';
            game[62] = 'p';
            game[63] = 'p';

            game2[48] = 2;
            game2[49] = 2;
            game2[50] = 2;
            game2[51] = 2;
            game2[52] = 2;
            game2[53] = 2;
            game2[54] = 2;
            game2[55] = 2;
            game2[56] = 2;
            game2[57] = 2;
            game2[58] = 2;
            game2[59] = 2;
            game2[60] = 2;
            game2[61] = 2;
            game2[62] = 2;
            game2[63] = 2;
        }


    }
}
